<assign name="page_title" value="注册" />
<assign name="current_item" value="reg" />
<include file="Public:header" />
<div id="main">
    <div id="main-header" class="grid page">
        <h2>爱咕噜</h2>
        <h1>你的私信</h1>
    </div>
    <div id="sub-main-header"></div>
    <div id="main-inner" class="account_settings page grid">
        <h4>注册</h4>
        <form action="__URL__/save" method="post" class="ajaxform">
            <table class="edit">
                <tr>
                    <td class="label small" width="30%">账号</td>
                    <td><input class="text" type="email" name="email" id="email" value="" required="required" placeholder="请填写常用的邮箱" /></td>
                </tr>
                <tr>
                    <td class="label small">性别</td>
                    <td><label class="label " for="sex1" style="display: inline;"><input class="radio" type="radio" name="sex" id="sex1" value="0" required="required" /> 男</label>&nbsp;&nbsp; 
                        <label class="label " for="sex2" style="display: inline;"><input class="radio" type="radio" name="sex" id="sex2" value="1" required="required" /> 女</label></td>
                </tr>
                <tr>
                    <td class="label small">密码</td>
                    <td><input class="text" type="password" placeholder="••••••••" name="password" required="required" id="password" value="" /></td>
                </tr>
                <tr>
                    <td class="label small">密码确认</td>
                    <td><input class="text" type="password" placeholder="••••••••" name="repassword" data-equals="password" required="required" id="repassword" value="" /></td>
                </tr>
                <tr>
                    <td class="label small">邀请码</td>
                    <td><input class="text" type="text" name="invite_code" id="invite-code" required="required" value="{{$code}}" style="vertical-align:baseline;" size="6" />&nbsp;&nbsp;
                        <a href="__ROOT__/account/reg/auth" class="small">你没有邀请码？</a></td>
                </tr>
                <tr>
                    <td></td>
                    <td><button class="btn btn_silver fbold" type="submit"><span>提交注册</span></button></td>
                </tr>
            </table>
        </form>
    </div>
</div>
<script>
    Do("validator",function(){
        $("form.ajaxform").validator().submit(function(e){
            var form = $(this);
            if (!e.isDefaultPrevented()) {
                Cute.api.post(form.attr("action"),form.serializeArray(), function(json){
                    if(json.status > 0){
                        new Cute.ui.dialog().suggest(json.info);
                        setTimeout(function(){
                            location.href = "{{$Think.config.SITE_URL}}";
                        },2500);
                    }else{
                        form.data("validator").invalidate(json.info);
                    }
                });
                e.preventDefault();
            }
        });
    });
</script>
<include file="Public:footer" />
